package show.me.the.money.accredit;

import java.io.Serializable;
import java.util.HashMap;

import org.dom4j.Element;

public class RoleAlias implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private Element define;
	private String id;
	private String name;
	private String ref;
	private String limit;
	
	public RoleAlias(Element el){
		this.define = el;
		id = el.attributeValue("id");
		name = el.attributeValue("name",id);
		ref = el.attributeValue("ref");
		limit = el.attributeValue("limit","0");
	}
	
	public String getSign(){
		return this.id +RolesController.R_SIGN+ this.ref;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Element getDefine() {
		return define;
	}

	public void setDefine(Element define) {
		this.define = define;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRef() {
		return ref;
	}

	public void setRef(String ref) {
		this.ref = ref;
	}

	public String getLimit() {
		return limit;
	}

	public void setLimit(String limit) {
		this.limit = limit;
	}
	
	public HashMap<String,Object> data(){
		HashMap<String,Object> rec = new HashMap<String,Object>();
		rec.put("id", this.id);
		rec.put("name", this.name);
		rec.put("ref", this.ref);
		rec.put("limit", this.limit);
		return rec;
	}
	
}
